<template funtional>
  <el-select clearable v-model="currentValue" placeholder="请选择">
    <el-option v-for="item of lists" :key="item.id" :label="item.typeValue" :value="item.name" />
  </el-select>
</template>

<script>
import { typeList } from '@/api/sys/dictType'
export default {
  name: 'DictSelect',
  props: {
    value: {
      required: true
    }
  },
  data() {
    return {
      lists: []
    }
  },
  computed: {
    currentValue: {
      get() {
        return this.value
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  mounted() {
    typeList().then(res => {
      const { obj } = res
      this.lists = JSON.parse(JSON.stringify(obj))
    })
  }
}
</script>
